#ifndef	_VM_MUL_LANG_
#define	_VM_MUL_LANG_

#include "vmsys.h"

#define		MUL_LANG_RES_NAME		"lang.bin"

//language type list
enum{
	VM_LANG_NULL = 0,
	
	VM_LANG_ENG,
	VM_LANG_CHS,
	VM_LANG_CHT,
	
	VM_LANG_TOTAL
};

#define		VM_LANG_ID_START		VM_LANG_ENG
#define		VM_LANG_ID_END			VM_LANG_CHT

#define		VM_LANG_ID_DEFAULT		VM_LANG_ENG


/**
 * Initialize the resource library of multpile language.
 * The resouce is stored in the "vm_res" section of VXP files.
 * The library in "vm_res" names "lang.bin".
 *
 * @return		NULL: Failed; else: Start address of resource library of multpile language.
 */
VMCHAR * vm_mul_lang_init( void );


/**
 * Finalize the resource library of multpile language.
 *
 * @param mul_lang_handle 		Start address of resource library of multpile language.
 */
void vm_mul_lang_deinit( VMCHAR * mul_lang_handle );


/**
 * Get specified string from the resource library of multpile language.
 *
 * @param lang_buf 		Start address of resource library of multpile language.
 * @param res_id		Resource ID of specified string.
 * @param lang_id  		Language type.
 * @param lang_buf  	Buffer for the specified string.
 *
 * @return				0: Failed; >0: Length of string.
 */
VMINT vm_mul_lang_get_string( VMCHAR * lang_buf, VMINT res_id, VMINT lang_id, VMCHAR ** str_buf );


/**
 * Set the current language.
 *
 * @param lang_buf  	language type.
 *
 * @return				1: Success; 0: Failed.
 */
VMINT vm_mul_lang_set_lang( VMINT lang_id );

/**
 * Get the current language.
 *
 * @return				language type, default:VM_LANG_ENG.
 */
VMINT vm_mul_lang_get_lang( void );

/**
 * Paint the text.
 *
 * @param disp_buf		Pointer of display buffer.
 * @param x				Left-top x coordinate of painting text.
 * @param y				Left-top y coordinate of painting text.
 * @param lang_buf		Pointer of resource library of multpile language.
 * @param res_id		Resource ID of string.
 * @param color			Color of text, in 565 format.
 *
 * @return				
 */
void vm_graphic_textout_by_id( VMUINT8* disp_buf, VMINT x, VMINT y, VMCHAR * lang_buf, VMINT res_id, VMUINT16 color);


/**
 * Get the resource length of specified string, unit in PX.
 *
 * @param lang_buf		Pointer of resource library of multpile language.
 * @param res_id		Resource ID of string.
 *
 * @return				String width in PX: Success; Error code: Failed.
 */
VMINT vm_graphic_get_string_width_by_id( VMCHAR * lang_buf, VMINT res_id );

#endif